From: Jasper St. Pierre Date: Thu, 16 Jul 2015 22:56:00 +0000 (-0700) Subject: shell-app: Stay consistent about application states X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~1298 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=7424ee755a0cf5a21a0887bd72aa3e833b0892e1;p=gnome-shell.git shell-app: Stay consistent about application states When the last interesting window of an app-backed window is removed, we'll transition it back to STOPPED, but we transition the state and send out the signal before we clear the running state. This means that any listeners to the state-changed signal might encounter a window-backed app that has a running state, but no windows. If they call, e.g. shell_app_get_name, while in this state, they'll encounter an assertion fail. --- diff --git a/src/shell-app.c b/src/shell-app.c index ca367b12e..c33807faa 100644 --- a/src/shell-app.c +++ b/src/shell-app.c @@ -1003,10 +1003,16 @@ _shell_app_remove_window (ShellApp *app, if (!meta_window_is_skip_taskbar (window)) app->running_state->interesting_windows--; - shell_app_sync_running_state (app); - if (app->running_state && app->running_state->windows == NULL) - g_clear_pointer (&app->running_state, unref_running_state); + if (app->running_state->windows == NULL) + { + g_clear_pointer (&app->running_state, unref_running_state); + shell_app_state_transition (app, SHELL_APP_STATE_STOPPED); + } + else + { + shell_app_sync_running_state (app); + } g_signal_emit (app, shell_app_signals[WINDOWS_CHANGED], 0); }